class CreateClicks < ActiveRecord::Migration
  def self.up
    create_table :clicks do |t|
      t.integer :recommendation_id
      t.datetime :when, :null => false
      t.string :referrer, :limit => 2083
      t.string :requester
      t.string :user_agent, :limit => 2083
    end

    add_index :clicks, :recommendation_id
    add_index :clicks, :when
    add_index :clicks, :referrer
    add_index :clicks, :requester
    add_index :clicks, :user_agent
  end

  def self.down
    remove_index :clicks, :recommendation_id
    remove_index :clicks, :when
    remove_index :clicks, :referrer
    remove_index :clicks, :requester
    #remove_index :clicks, :user_agent
    drop_table :clicks
  end
end

